Skip to content

fix: help text — cached hits echo the original run's bill, not 0 - #178

Closed
yuanwen-tian wants to merge 1 commit into
mainfrom
claude/bold-torvalds-ba1c7a
Closed

fix: help text — cached hits echo the original run's bill, not 0#178
yuanwen-tian wants to merge 1 commit into
mainfrom
claude/bold-torvalds-ba1c7a

Conversation

@yuanwen-tian

Copy link
Copy Markdown
Contributor

Summary

The published result-shape contract (ade help results parse / extract, and the committed snapshot docs/reference/help.json) said the credits key is "credits billed (0 on a cached hit)". The actual behavior — verified live against production — is that a cached hit echoes the original run's bill alongside cached: true.

The behavior is the intended side of the contract, so this fixes the docs rather than the code:

  • The human summary deliberately prints the original credits: N (tier) line on cached hits from the same billing dict — zeroing only the JSON payload would make the two outputs of one invocation contradict each other.
  • history denormalizes the same original-bill value into meta.json per item.
  • cached: true is already the free-serve marker a scripter gates on; echoing the bill is strictly more informative, and changing it would silently break the shipped payload contract.

Changes

  • src/ade_cli/help.py: both credits descriptions (parse + extract) now read "credits the run billed (a cached hit echoes the original run's bill; nothing new is billed — see cached)".
  • docs/reference/help.json: regenerated via scripts/update_help_reference.py.
  • Offline tests pinning the cached-hit value with a distinctive total_credits=1.1 so a zeroing regression can't slip through: test_cached_hit_echoes_the_original_bill (parse) and test_cached_extract_echoes_the_original_bill (extract).

Testing

  • uv run pytest -q — 697 passed
  • uvx ruff check src tests / uvx ty check src — clean

🤖 Generated with Claude Code

The published result-shape contract said `credits` is "credits billed
(0 on a cached hit)", but the actual (and intended) behavior on a
cached hit is to echo the original run's bill alongside cached=true:
the human summary prints the same value, and history denormalizes it
per item. Fix the help text for both parse and extract, regenerate
docs/reference/help.json, and pin the cached-hit `credits` value with
offline tests for both verbs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the published result contract to match cached billing behavior.

Changes:

  • Clarifies cached credits semantics for parse and extract.
  • Regenerates the help reference snapshot.
  • Adds regression tests for cached billing values.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/ade_cli/help.py Corrects result-field documentation.
docs/reference/help.json Updates the generated help snapshot.
tests/test_parse.py Tests cached parse credits.
tests/test_extract.py Tests cached extract credits.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants